$(document).ready(function() {
	$('.toolbar_item').click(function(){
		var window = $(this).attr("alt");
		          if($("#" + window).is(":hidden")){ 


						$.ajax({
				    		type: "GET",
				    		url: "../../../../../process.php",
				    		data: {"set" : window},
				    		dataType: "HTML",
				    		success: function(msg){
				    			$(".toolbar_window").fadeOut();
				    			$("#"+window).fadeIn();
				    		}
				    	});
						
						
		          }else{

						$.ajax({
				    		type: "GET",
				    		url: "../../../../../process.php",
				    		data: {"unset" : window},
				    		dataType: "HTML",
				    		success: function(msg){
				    			$(".toolbar_window").fadeOut();
				    			$("#"+window).fadeOut();
				    		}
				    	});
						
                  }
	});
	
	$('.open_window').click(function(){
		var window = $(this).attr("alt");
		        if($("#" + window).is(":hidden")){ 			
								$("#"+window).addClass("dropdown");
					          	$(".admin_window").hide();
								$("#"+window).show();					
		        }else{
					$("#"+window).addClass("dropdown");
					    $(".admin_window").hide();
						$("#"+window).hide();
                }
	});
	
        $('.adminform').submit(function(e){
         
            var name = $(this).attr('name');
            var method = $(this).attr('method');           
                    e.preventDefault();
                
            		$.ajax({
                		type: method,
                		url: "../../../../../admin/post.php",
                		data: $(this).serialize(),
                		dataType: "html",
                        enctype: 'multipart/form-data',
                		success: function(msg){
                		      alert(msg);
                            
                		}
                	});                    
    });
	
	
	$('.quick_edit_news').click(function(){
		var news = $(this).attr("id");
		$("article."+news).html("<textarea class='tinymce'></textarea>");
	});
});

